﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using control.Biz;
namespace BaiTapDoAn
{
    public partial class ThongKeSanPham : Form
    {
        List<BizSach> tks = new List<BizSach>();
        List<BizChuDe> cds = new List<BizChuDe>();
        public ThongKeSanPham()
        {
            InitializeComponent();
        }

        private void ThongKeSanPham_Load(object sender, EventArgs e)
        {           
            //cds = BizChuDe.GetAll();
            //cds.Add(new BizChuDe(0, "- - - Tất Cả - - -"));
            //comboBox_ChudeSP.DataSource = cds;
            //comboBox_ChudeSP.Text = "- - - Tất Cả - - -";
        }

        private void button_XemTK_Click(object sender, EventArgs e)
        {
            int soLuongLH = txt_SoLuongLH.Text != "" ? int.Parse(txt_SoLuongLH.Text) : 0;
            int soLuongNH = txt_SoLuongNH.Text != "" ? int.Parse(txt_SoLuongNH.Text) : 0;
          //  int idChuDe = int.Parse(comboBox_ChudeSP.SelectedValue.ToString());
            //if (soLuongLH != 0)
            //    tks = BizSach.XemTK(soLuongLH, datetp_Batdau, dateTP_ngayKT);
            //else
            //    tks = BizSach.XemTK1(soLuongNH,datetp_Batdau,dateTP_ngayKT);
            //else
              //  tks = BizSach.XemTK(idChuDe, soLuong, datetp_Batdau, dateTP_ngayKT);
            tks = BizSach.XemThongKe(soLuongLH,soLuongNH, datetp_Batdau.Value, dateTP_ngayKT.Value);
            dataGridView_DSTK.AutoGenerateColumns = false;
            dataGridView_DSTK.DataSource = tks;
        }

        private void groupBox_TKSP_Enter(object sender, EventArgs e)
        {

        }

        private void bnt_In_Click(object sender, EventArgs e)
        {
            ////gan datasource
            //CrystalReport_TKSL tksl = new CrystalReport_TKSL();
            //tksl.SetDataSource(dataGridView_DSTK.DataSource);
        

            ////thiet lap parameter
            //tksl.SetParameterValue("NgayBD", datetp_Batdau.Value.ToString("dd/MM/yyyy"));
            //tksl.SetParameterValue("NgayKT", dateTP_ngayKT.Value.ToString("dd/MM/yyyy"));
            //crystalReportViewer1.ReportSource = tksl;
            
        }

       
    }
}
